package com.mbdz.util;

import lombok.Data;

@Data
public class R<T> {
    private Integer code;
    private String msg;
    private T data;
    public R(Integer code, String msg, T data){
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    public static <T> R<T> success(T data){
        return new R<T>(0, "success", data);
    }

    public static <T> R<T> success(String msg, T data){
        return new R<T>(0, msg, data);
    }

    public static <T> R<T> error(String msg){
        return new R<T>(1, msg, null);
    }

}
